package cn.itcast.mapper;

import cn.itcast.domain.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
//insert into user values(#{id},#{name},#{gender},#{age},#{address},#{qq},#{email}
public interface UserMapper {

    //查询所有用户
    @Select("select * from user")
    List<User> findAll();

    //添加用户
    @Insert("insert into user  values(#{id},#{name},#{gender},#{age},#{address},#{qq},#{email},null)")
    void add(User user);

    //删除用户
    void deleteByIds(String[] uids);

    //查询一条用户
    @Select("select * from user where  id = #{uid}")
    User findById(String uid);

    //根据id修改用户信息
    @Update("update user set name = #{name},gender=#{gender},age=#{age},address=#{address},qq=#{qq},email=#{email} where id = #{id}")
    void update(User user);
}
